<template slot-scope="scope">
  <Modal v-model="model" title="添加成员" sticky reset-drag-position  @on-cancel="cancel" footer-hide  scrollable class="message_template_pop Internal_call" width="800">
    <div style="margin-bottom:10px;display: flex;" >
      <div style="background-color:#dae2fb;padding:10px 20px 0px 20px;height:33px;height:40px"><p style="color:#687084;">邀请人员:</p></div>
      <Input v-model="transmitnumber" placeholder="请输入工号或手机号码(多个以英文逗号间隔)" style="width:70%;margin-right:15px"/>
      <Button type="primary" @click="invite()">邀请</Button>
    </div>
  </Modal>
</template>

<script>
  export default {
    name: "Invitepage",
    props: {
      showInvitepage:Boolean,
    },
    data(){
      return {
        opstsisons: [],
        model:false,
         value: [],//显示邀请的值
        agentNum:'',//输入的值
        transmitnumber:'',

      }
    },
    methods:{
      cancel:function(){
         this.$emit("closeInvitepage",'cancel');
      },
      
      invite:function () {
          let that=this;
          let number=this.transmitnumber;
          if(number ==""){
            that.$Message.info("号码不能为空");
            return false;
          }
          that.$emit("closeInvitepage",'invitee',that.transmitnumber.split(','));
      },
      //通讯录相关
      getmailbnumber:function(selection){
        let mailcombin="";
        for (let i=0;i<selection.length;i++){
              let choosenumber=selection[i].telephone;
              let choosename=selection[i].userName;
              mailcombin=choosenumber+"("+choosename+")";
              let index =this.transmitnumber.indexOf(mailcombin);
              if(index==-1){
                this.transmitnumber.push(mailcombin);
              }
        }
      },

    },
    computed:{
        search(){
          return this.agentNum;
        }
    },
    watch:{
      showInvitepage:function () {
        this.transmitnumber=[];
        this.definenumber=[];
        this.agentNum="";
        this.model=this.showInvitepage;
        let that = this;
        this.searchCustomerFlag = false;
        this.mailnumber="";

      },
      search(newValue,oldValue){
          if(newValue===""){
            this.searchCustomerFlag = false;
            this.infoTableList=this.oldTableList;
          }else{
            // 当不点击搜索是，才会过滤工号，点击搜索，不过滤
            if(this.searchCustomerFlag){
              return;
            }
            if(newValue){
              this.infoTableList = this.oldTableList.filter(item => item.number.indexOf(newValue) > -1);
            }else{
              this.infoTableList = this.oldTableList;
            }
          }
      }
    }


  }
</script>

<style lang="less">
.el-select-dropdown__empty{
    display: none;
}
</style>
